package com.neusoft.yuejian_01.model;

import com.neusoft.yuejian_01.base.BaseModel;
import com.neusoft.yuejian_01.javabean.FeedBackBean;
import com.neusoft.yuejian_01.listener.RetrofitListener;
import com.neusoft.yuejian_01.service.FeedBackService;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by MARIA on 2017/10/14.
 */

public class FeedBackModel extends BaseModel {
    //发布反馈
    public void feedback(int u_id, String content,final RetrofitListener listener) {
        this.flag = Const.FeedBack;
        FeedBackService feedBackService = retrofit.create(FeedBackService.class);
        Call call = feedBackService.feedback(u_id,content);
        call.enqueue(new Callback<FeedBackBean>() {
            @Override
            public void onResponse(Call<FeedBackBean> call, Response<FeedBackBean> response) {
                FeedBackBean addFeedBackBean=response.body();
                listener.onSuccess(addFeedBackBean,flag);
            }
            @Override
            public void onFailure(Call<FeedBackBean> call, Throwable t) {
                listener.onFail();
            }
        });
    }

}